PYTHON-5406 - AsyncPeriodicExecutor must reset CSOT contextvars befor…#2360
Merged
NoahStapp merged 5 commits intomongodb:masterfrom Jun 6, 2025
Merged
PYTHON-5406 - AsyncPeriodicExecutor must reset CSOT contextvars befor…#2360NoahStapp merged 5 commits intomongodb:masterfrom
NoahStapp merged 5 commits intomongodb:masterfrom
Conversation
ShaneHarvey
reviewed
Jun 5, 2025
pymongo/_asyncio_task.py
Outdated
| return self._cancel_requests | ||
|
|
||
|
|
||
| # We can directly pass an empty Context() object to create_task in Python >= 3.11 |
Member
There was a problem hiding this comment.
I'm not sure we'd want to do that. The user might be have contextvars that they want to propagate to the background tasks.
Contributor
Author
There was a problem hiding this comment.
A better idea I had was to explicitly remove our CSOT contextvars and leave the rest alone.
Member
There was a problem hiding this comment.
Then, should we remove this comment?
Contributor
Author
|
Test failures are unrelated, known flakey tests on PyPy. |
ShaneHarvey
approved these changes
Jun 6, 2025
blink1073
pushed a commit
to blink1073/mongo-python-driver
that referenced
this pull request
Jun 10, 2025
mongodb#2360) (cherry picked from commit 536b1cb)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…e executing
TODO: add tests to confirm that unwanted ContextVar state is not carried over to
AsyncPeriodicExecutortasks.